//
//  Q2ViewController.m
//  Assignment1_Q2
//
//  Created by LxL on 2012-10-07.
//  Copyright (c) 2012 LxL. All rights reserved.
//

#import "Q2ViewController.h"

@interface Q2ViewController ()
{
    bool isCpp;
}
@end

@implementation Q2ViewController


- (void)viewDidLoad
{
    [super viewDidLoad];
	// Do any additional setup after loading the view, typically from a nib.
    
    isCpp=NO;
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (void)viewDidUnload {
    [self setLbValue:nil];
    [super viewDidUnload];
}
- (IBAction)btn_Change:(UIButton *)sender {
    if(isCpp){
        Q2MyCpp *tmp= new Q2MyCpp(10);
        self.lbValue.text= [NSString stringWithFormat:@"%d", tmp->intValue];
        delete tmp;
        isCpp=!isCpp;
    }else{
        Q2MyObjectC *tmp= [[Q2MyObjectC alloc]init:5];
        self.lbValue.text= [NSString stringWithFormat:@"%d", tmp.intValue];
        tmp=nil;
        isCpp=!isCpp;
    }
}
@end
